Load Zambia’s ministry of agriculture maize forecasts data as reference.
Load data
Load and aggregate RHEAS simulated Leaf Area Index (LAI), Water stress and Grain Weight Average Dry (GWAD) across different ensembles. Extract year from dates (we will use harvest year).
Aggregate RHEAS production forecasts and metrics with respect to Districts maize growing calendar.
There is one maize growing seasons in Malawi than runs from October to May/June.
So we will aggregate the metrics and yield forecast per district with
this condition using the function RH_metrics.
Convert RHEAS yields from kg/ha to MT/ha.
Add shapefile for visualization.
## Warning: multiple methods tables found for 'approxNA'
Check and format District names to be consistent in both the RHEAS and administrative boundaries.
## character(0)
Merge RHEAS and Admin data.
Visualize RHEAS predicted yields spatially.
## Warning: multiple methods tables found for 'crop'
## Warning: multiple methods tables found for 'extend'
Visualize trends for the last 5 years.
## Warning: package 'ggplot2' was built under R version 4.1.3
Compare RHEAS with MoA forecasts.
Merge the MoA forecasts with RHEAS ones by year and District.
We can use the Root Mean Square Error (RMSE) and mean absolute percentage error (MAPE) to evaluate the models accuracy. RMSE is given as:
\[ \text{RMSE} = \sqrt{\frac{1}{n} \sum_{i=1}^n y-\widehat{y}}, \] where \(\widehat{y}\) and \(y\) are predicted yields and observed yields respectively while n is the number of fitted points.
Compute RMSE.
## RMSE 1.315946
What about Relative root mean square error (RRMSE):
\[ \text{RRMSE} = \frac{\sqrt{\frac{1}{n} \sum_{i=1}^n y-\widehat{y}}}{\frac{1}{n} \sum_{i=1}^n y}, \]
Compute RRMSE.
## RRMSE 67.71467
According to Li et al. 2013, the performance of the model is excellent when RRMSE < 10%; good if 10% < RRMSE < 20%; fair if 20% < RRMSE < 30%; and poor if RRMSE ≥ 30%.